package com.example.weather_app.base;

import android.util.Log;

import androidx.fragment.app.Fragment;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * 网络请求
 * 1、声明整体模块
 * 2、执行网络请求操作
 * 3、返回结果
 */
public class BaseFragment extends Fragment implements Callback.CommonCallback<String> {

    public void loadData(String path){
        RequestParams params = new RequestParams(path);
        x.http().get(params,this);
        Log.i("TAG", "loadData: ");
    }

    @Override
    public void onSuccess(String result) {

    }

    @Override
    public void onError(Throwable ex, boolean isOnCallback) {

    }

    @Override
    public void onCancelled(CancelledException cex) {

    }

    @Override
    public void onFinished() {

    }
//
//    public void loadIndexData(String path){
//        RequestParams params = new RequestParams(path);
//        x.http().get(params,this);
//        Log.i("TAG", "loadIndexData: ");
//    }


}
